Skip to content

Add blocking deepwork installation check to SessionStart hook#132

Merged
nhorton merged 6 commits intomainfrom
claude/add-deepwork-version-check-YVR2E
Jan 23, 2026
Merged

Add blocking deepwork installation check to SessionStart hook#132
nhorton merged 6 commits intomainfrom
claude/add-deepwork-version-check-YVR2E

Conversation

@nhorton
Copy link
Contributor

@nhorton nhorton commented Jan 23, 2026

Summary

This PR adds a critical blocking check to the check_version.sh SessionStart hook to verify that the deepwork command is installed and directly invokable before allowing any session to proceed. This prevents confusing downstream errors when deepwork is not properly installed.

Key Changes

  • New deepwork installation check: Added check_deepwork_installed() function that verifies deepwork --version can be executed directly
  • Blocking error handling: Returns exit code 2 (blocking) when deepwork is not found, preventing session continuation
  • User-friendly error messaging: Added comprehensive error output explaining:
    • What the problem is (deepwork not installed or not directly invokable)
    • Why it matters (hooks cannot function without it)
    • What NOT to do (avoid uv run deepwork wrappers)
    • Installation options (pipx, pip, nix)
  • JSON error output: Outputs structured error JSON with additionalContext for Claude to inform the user
  • Check ordering: Deepwork check runs first (before version check) to catch installation issues immediately
  • Comprehensive test coverage: Added 5 new tests covering:
    • Successful deepwork detection
    • Blocking behavior when deepwork is missing
    • Error message content validation
    • JSON output validation
    • Check ordering verification

Implementation Details

  • The deepwork check runs on every hook invocation (no re-entry guard) because if deepwork is not installed, nothing else will work
  • The version check retains its existing re-entry guard to avoid duplicate warnings
  • Error messages are printed to stderr for visibility while JSON output goes to stdout for hook processing
  • Exit code 2 is used to distinguish blocking errors from normal operation (exit 0)

claude and others added 6 commits January 23, 2026 17:09
Check that the 'deepwork' command is installed and directly invokable
before proceeding with a session. If deepwork is not available, display
a blocking error (exit code 2) with clear instructions:
- Error message explains that deepwork must be directly invokable
- Warns against using wrappers like 'uv run deepwork'
- Provides installation options (pipx, pip install --user, nix develop)

This check runs before the Claude Code version check since hooks cannot
function without deepwork being available.

https://claude.ai/code/session_01LaPvwtJqYWx4yQArYpkCnH
Change the deepwork installation check from `deepwork --version` to
`deepwork rules clear_queue`. This serves double utility:
1. Verifies the deepwork command is installed and directly invokable
2. Clears any stale rules from the queue, ensuring a clean session start

https://claude.ai/code/session_014UavMC2aJxUh1uwhhJqz7S

Co-authored-by: Claude <noreply@anthropic.com>
* feat: Add deepwork CLI and jobs folder permissions to installer

Add required permissions to Claude Code settings.json during sync:
- Bash(deepwork:*) for all deepwork CLI commands
- Read/Edit/Write for .deepwork/jobs/** for job definitions

https://claude.ai/code/session_01NJKQitsNTE3HUcPuDBM7iM

* refactor: Simplify permissions to full .deepwork/** access

Instead of separate permissions for tmp and jobs subdirectories,
grant full Read/Edit/Write access to the entire .deepwork directory.

https://claude.ai/code/session_01NJKQitsNTE3HUcPuDBM7iM

---------

Co-authored-by: Claude <noreply@anthropic.com>
When deepwork is installed with restrictive permissions (e.g., read-only),
shutil.copytree/copy preserve those permissions on copied files. This
causes issues when users later try to modify or delete the copied files.

Added fix_permissions() utility that ensures user-writable permissions
(u+rw for files, u+rwx for directories) while preserving executable bits.
Applied to all file copy operations in install.py and fs.py copy_dir().

https://claude.ai/code/session_01QpLzkbcggStMKFCmTcE4Bs

Co-authored-by: Claude <noreply@anthropic.com>
The sync_permissions tests were checking for old permission patterns
(.deepwork/tmp/**) but the implementation was changed to use broader
patterns (.deepwork/**) and deepwork CLI permissions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nhorton nhorton merged commit 9243604 into main Jan 23, 2026
4 checks passed
@nhorton nhorton deleted the claude/add-deepwork-version-check-YVR2E branch January 23, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants